{% extends "base.html" %}

{% load table_row_highlight %}

{% block extrahead %}
<script type='text/javascript' src='/appmedia/js/routines.js'></script>

<script language="JavaScript" type="text/javascript">
    document.onmousedown=dragHandler;
</script>
{% endblock %}



{% block content %}
	<!-- <div class="form_layer"> -->
		<h1 class="help_header">
		Customers
		</h1>
		<p class="about help_text">
		The project may belong to some customer. So you may assign this customer to the project. 
		<br/> 
		Customers are not required. If you only want to simple manage your ideas and task, go on to the <a class="header_line" href="/">Whiteboard</a>.
		</p>
		
		<div id="Menu">
			<a class="toolbar" id="add_customer" href="javascript:AddItem('add_customer', 'customer')">
				<img src="/appmedia/add.gif">
				add customer
			</a>
			::
			<a class="toolbar" id="export_customers" href="/export_customers/">
				<img src="/appmedia/csv.gif">
				export to CSV
			</a>
		</div>
		<div id="customers">
			<table cellspacing="0">
				<tr id="Menu">
					<th class="caption">
						Customer name
					</th>
					<th class="caption">
						e-Mail
					</th>
					<th class="caption">
						Archive
					</th>
				</tr>
			{% if customers %}
				{% for customer in customers %}
					<tr class="{% odd_even_row forloop.counter 'odd' 'even' %}">
						<td class="odd" width="50%">
							<a href="/customer/edit/{{customer.id}}/">{{customer.name}}</a>
						</td>
						<td class="odd">
							<a href="/customer/edit/{{customer.id}}/">{{customer.email}}</a>&nbsp;
						</td>
						<td class="odd" width="14" align="center">
							<a href="/customer/archive/{{customer.id}}/"><img src="/appmedia/delete.gif" title="Archive customer"></a>
						</td>
					</tr>
				{% endfor %}
			{% else %}
					<tr>
						<td colspan="4">
						<center>
						<p>
						You don't have any information about customers here. To add click 
						<a class="toolbar" id="add_customer" href="javascript:AddItem('add_customer', 'customer')">
							<img src="/appmedia/add.gif">
							add customer
						</a>
						</center>
						</td>
					</tr>
			{% endif %}
			</table>
		</div>
	<!-- </div> -->
{% endblock %}



{% block header_content %}
	<div id="add_item_wnd" style="visibility:hidden;display:none;">
		<form id="add_item_form" method="POST" action=''>
		<table cellspacing="0">
			<tr>
				<td colspan="2">
					<h1 id="add_item_caption" style="margin-top:0px;margin-bottom:2px">New item</h1>
				</td>
				<td align="right">
					<a class="button" style="margin:0px" href="javascript:HideWnd()">X</a>
				</td>
			</tr>
			<tr>
				<td align="right" colspan="3">
					Name:&nbsp;&nbsp;&nbsp;&nbsp;<input id="id_name" name="name" type="text" style="width:255px">
					<input type="hidden" name="time_spent" value="0.0">
				</td>
			</tr>
			<tr>
				<td colspan="3">
					<input class="submit" type="submit" value="Save">
				</td>
			</tr>
		</table>
		</form>
	</div>
{% endblock %}

